package de.hsb.ai.agent.jcau;

import game.Link;
import game.Move;
import game.Node;
import game.Transport;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.TreeSet;

import de.hsb.ai.agent.AbstractDetective;
import de.hsb.ai.domain.MoveEvent;
import de.hsb.ai.util.map.ScotlandJadeMapHelper.ScotlandJadeVertex;
import de.hsb.ai.util.map.ScotlandJadeMapHelper.ScotlandJadeEdge;
/**
 * EstimatingDetectiveTac1 Estimates the possible Positions of Mr. X and moves
 * to direction of a randomized possible position of Mr.X
 */
@SuppressWarnings("serial")
public class EstimatingDetectiveTac3 extends EstimatingDetective {

	
	public EstimatingDetectiveTac3() {
		super("estimatingTac3");
	}
	
	@Override
	protected Move getMove(List<Move> options) {
		if (lastKnownFugitivePosition != -1){
			//initialize temporary distance and reset required values
			
			
			debugEstimatedPosition = 0;
			
			
			for (ScotlandJadeVertex v : possibleNodes){	
				if(v.getType() != ScotlandJadeVertex.Type.DETECTIVE){
					possibleNode = v.getIndex();
					debugEstimatedPosition = possibleNode;
					break;
				}
			}
			
			
			
			
			
			//Reset "nextMove" to recognize in case of no move was found
			//Reset max Value for new searching
			searchDepth = Integer.MAX_VALUE;
			nextMove = null;
			
			
			
			//Start A* to find the shortest path to destination
			determineNextMove(currentPosition, 0);
			
			
			
//				logger.debug(Integer.toString(nextMove.getNode()));
	
			
			
		
			logger.debug("Estimating Mr. X at: " + debugEstimatedPosition);
		}
		return super.getMove(options);
	}
	
	@Override
	protected void handleMove(MoveEvent m) {
		
		super.handleMove(m);
		
		
		
	}
	
}
